export type GetContainer = HTMLElement | (() => HTMLElement) | null | undefined

/**
 * @param {GetContainer} getContainer
 * @returns {GetContainer | Document} `getContainer`
 */
export function resolveContainer(
  getContainer: GetContainer,
): GetContainer {
  const container = typeof getContainer === 'function'
    ? getContainer()
    : getContainer
  return container || document.body
}
